<script src="http://360haigou.com/welive/welive.php" language="javascript"></script>

	{set:$seo_data=array(); $site_config=new Config('site_config');$site_config=$site_config->getInfo();}
	{set:$seo_data['title']=isset($site_config['name'])?$site_config['name']:""}
	{if:isset($site_config['index_seo_title']) && $site_config['index_seo_title']!="" }
		{set:$seo_data['title'].=$site_config['index_seo_title'];}
	{/if}
	{if:isset($site_config['index_seo_keywords']) && $site_config['index_seo_keywords']!="" }
		{set:$seo_data['keywords']=$site_config['index_seo_keywords'];}
	{/if}
	{if:isset($site_config['index_seo_description']) && $site_config['index_seo_description']!="" }
		{set:$seo_data['description']=$site_config['index_seo_description'];}
	{/if}
	{set:seo::set($seo_data);}

	<script type='text/javascript'>
		//dom载入完毕执行
		jQuery(function(){
			//index 分类展示
			$('#index_category tr').hover(
				function(){
					$(this).addClass('current');
				},
				function(){
					$(this).removeClass('current');
				}
			);

			//email订阅 事件绑定
			var tmpObj = $('input:text[name="orderinfo"]');
			var defaultText = tmpObj.val();
			tmpObj.bind({
				focus:function(){checkInput($(this),defaultText);},
				blur :function(){checkInput($(this),defaultText);}
			});
		});

		//显示抢购倒计时
		var cd_timer=new countdown();

		//电子邮件订阅
		function orderinfo()
		{
			var email = $('[name="orderinfo"]').val();
			if(validate(email,'email') == false)
			{
				alert('请填写正确的email地址');
			}
			else
			{
				$.getJSON('{url:/site/email_registry}',{email:email},function(content){
					if(content.isError == false)
					{
						alert('订阅成功');
						$('[name="orderinfo"]').val('');
					}
					else
						alert(content.message);
				});
			}
		}
	</script>

	<div class="wrapper clearfix">
		<div class="main f_l">

			{if:count($this->index_slide)}
			{set:$num=count($this->index_slide);$i=0;$width=intval(100/$num);}
			<div id="slide_box" class="slide box" style="width:100%;height:299px;overflow:hidden;position:relative;">
				<div id="slide_img" style="position:relative;">
					{foreach:items=$this->index_slide}
					<a href="{$item['url']}" target="_blank"><img src="{webroot:$item[img]}" width="100%" /></a>
					{set:break;}
					{/foreach}
				</div>
				<div class="slide_button" style="width:100%;overflow:hidden;">
					{foreach:items=$this->index_slide}
						{set:$i++;}
						{if:$i==$num}
							{set:$width=100-($num-1)*$width;}
						{/if}
					<a style="width:{$width}%" href='{$item['url']}' pic='{webroot:$item[img]}'>{$item['name']}</a>
					{/foreach}
				</div>

			</div>
			{else:}
			<div class="slide box" style="width:100%;height:299px;overflow:hidden;position:relative;">
			</div>
			{/if}

		</div>
<style type='text/css'>
.slide_button{position:absolute;bottom:0px;left:0px;right:0px;height:30px;overflow:hidden;width:100%;background:#fff;}
.slide_button a{display:block;height:30px;line-height:30px;color:#333;float:left;background:#dddddd;}
.slide_button a.current,#slide_name a:hover{background:#a8a8a8;color:#fff; font-weight:bold}
.flowstyle{float:left;padding:5px;border:1px solid #f76f10 ;border-bottom:hidden;cursor: hand;font-size:14px;font-weight:bold;color:white;background-color:#f76f10; }
.flowstyleselected{float:left;border:1px solid #f76f10 ;border-bottom:hidden;padding:5px;cursor: hand;font-size:14px;font-weight:bold;color:#f76f10;}
</style>
<script type='text/javascript'>
function slide(arr)
{
	var _self=this;
	this.is_mouseover=false;
	this.arr=arr;

	this.init=function()
	{
		$(arr+" .slide_button a").mouseover(function(){ _self.show(this); });
		$(arr+" .slide_button a").click(function(){_self.show(this);return false;});
		$(arr+" .slide_button a:first").click();
	}

	this.show=function(slide_a)
	{
		$(arr+ " .slide_button a").removeClass('current');
		$(slide_a).addClass('current');
		var src=$(slide_a).attr('pic');
		var e=$(arr+ " img");
		$(arr + " #slide_img a").attr('href',slide_a.href);
		e.fadeOut('fast',function(){e.attr('src',src);e.fadeIn('fast');});
		$(arr+ " .slide_button a").attr('href',this.href);
	}

	this.autonext=function()
	{
		if(_self.is_mouseover==true)
		{
			return;
		}
		var e=$(_self.arr).find(".slide_button .current").next();
		if(e.length==0)
		{
			e=$(_self.arr).find(".slide_button a:first");
		}
		e.click();

	}
	$(arr).hover(function(){_self.is_mouseover=true;},function(){_self.is_mouseover=false;});
	setInterval(_self.autonext,3000);
}

$(document).ready(function(){
	var slideObj=new slide("#slide_box");
	slideObj.init();

	
});

function selectedCatShow(showId,liObj)
{
	
	$('#newProductDiv').hide('slow');
	$('#recommendProductDiv').hide('slow');
	$('.flowstyleselected').removeClass().addClass('flowstyle');
	$('#'+showId).show('slow');
	$(liObj).removeClass().addClass('flowstyleselected');
}

</script>
	</div>

	

	<div class="wrapper clearfix">
		
        <div style="width:100%;">
             <ul >
               <li class="flowstyleselected" onmouseover="selectedCatShow('newProductDiv',this)" >最新商品</li>
			   <li class="flowstyle" onmouseover="selectedCatShow('recommendProductDiv',this)">热卖商品</li>
              
			 </ul>
		</div>
		<div class="main f_l">
		   
            <!--最新商品-->
			<div id="newProductDiv" class="box yellow m_10">
				<div class="title2">
					<h2><img src="{skin:images/front/new_product.gif}" alt="最新商品" width="160" height="36" /></h2>
				</div>
				<div class="cont clearfix">
					<ul class="prolist">
						{query:name=commend_goods as co join=left join goods as go on co.goods_id eq go.id
							where=co.commend_id eq 1 and go.is_del eq 0 AND go.id is not null
							fields=go.list_img,go.sell_price,go.name,go.market_price,go.id
							limit=8
							order=id desc
							group = id
						}
						<li style="overflow:hidden">
							{set:$tmpId=$item['id'];}
							<a href="{url:/site/products/id/$tmpId}"><img src="{webroot:$item[list_img]}" width="175" height="175" alt="{$item['name']}" /></a>
							<p class="pro_title"><a title="{$item['name']}" href="{url:/site/products/id/$tmpId}">{$item['name']}</a></p>
							<p class="brown">惊喜价：<b>￥{$item['sell_price']}</b></p>
							<p class="light_gray">市场价：<s>￥{$item['market_price']}</s></p>
						</li>
						{/query}
					</ul>
				</div>
			</div>
			<!--最新商品-->
			<!--热卖商品-->
			<div id="recommendProductDiv" class="box yellow m_10" style="display:none;">
				<div class="title2">
					<h2><img src="{skin:images/front/new_product.gif}" alt="热卖商品" width="160" height="36" /></h2>
				</div>
				<div class="cont clearfix">
					<ul class="prolist">
						{query:name=commend_goods as co join=left join goods as go on co.goods_id eq go.id
							where=co.commend_id eq 3 and go.is_del eq 0 AND go.id is not null
							fields=go.list_img,go.sell_price,go.name,go.id
							limit=8
							order=sort asc,id desc
						}
						<li style="overflow:hidden">
							{set:$tmpId=$item['id']}
							<a href="{url:/site/products/id/$tmpId}"><img src="{webroot:$item[list_img]}" width="175" height="175" alt="{$item['name']}" /></a>
							<p class="pro_title"><a href="{url:/site/products/id/$tmpId}">{$item['name']}</a></p>
							<p class="brown"><b>￥{$item['sell_price']}</b></p>
						</li>
						{/query}
					</ul>
				</div>
			</div>
			<!--热卖商品-->
			<!--首页推荐商品-->
			
			{foreach:items=$this->goodsCategory item=$first}
			{if:$first['visibility'] == 1}
			<div id="{$first['id']}Div" class="box yellow m_10" >
				<div class="title title3">
					{set:$tmpFirstId=$first['id'];}
					<h2><a href="{url:/site/pro_list/cat/$tmpFirstId}"><strong>{$first['name']}</strong></a></h2>
					<a class="more" href="{url:/site/pro_list/cat/$tmpFirstId}">更多商品...</a>
					<ul class="category f_r">
						{set:$secondIdArray = array()}
						{if:isset($first['second'])}
						{foreach:items=$first['second'] item=$second}
							{if:$second['visibility'] == 1}
								{set:$secondIdArray[] = $second['id']}
								{if:$second['more']}
									{foreach:items=$second['more'] item=$v}
										{set:$secondIdArray[] = $v['id']}
									{/foreach}
								{/if}
								{set:$tmpSecondId=$second['id'];}
								<li><a href="{url:/site/pro_list/cat/$tmpSecondId}">{$second['name']}</a><span></span></li>
							{/if}
						{/foreach}
						{/if}
					</ul>
				</div>

				<div class="cont clearfix">
					<ul class="prolist">
						{set:$recomCatId = $first['id']}
						{if:!empty($secondIdArray)}
							{set:$recomCatId .= ','.join(',', $secondIdArray );}
						{/if}
						{query:name=category_extend as ca join = left join goods as go on go.id eq ca.goods_id
						where = ca.category_id in ($recomCatId) and go.is_del eq 0
						limit = 8
						order = go.sort asc,go.id desc
						fields= DISTINCT go.list_img,go.id,go.name,go.sell_price,go.market_price
						}
						<li style="overflow:hidden">
							{set:$tmpId=$item['id'];}
							<a href="{url:/site/products/id/$tmpId}"><img src="{webroot:$item[list_img]}" width="175" height="175" alt="{$item['name']}" title="{$item['name']}" /></a>
							<p class="pro_title"><a title="{$item['name']}" href="{url:/site/products/id/$tmpId}">{$item['name']}</a></p>
							<p class="brown">惊喜价：<b>￥{$item['sell_price']}</b></p>
							<p class="light_gray">市场价：<s>￥{$item['market_price']}</s></p>
						</li>
						{/query}
					</ul>
				</div>

			</div>
			{set:$colorIndex++;}
			{/if}
			{/foreach}

			<!--品牌列表-->
			<div class="brand box m_10">
				<div class="title2"><h2><img src="{skin:images/front/brand.gif}" alt="品牌列表" width="155" height="36" /></h2><a class="more" href="{url:/site/brand}">&lt;<span>全部品牌</span>&gt;</a></div>
				<div class="cont clearfix">
					<ul>
						{query:name=brand fields=id,name,logo order=sort asc limit=6}
						{set:$tmpId=$item['id'];}
						<li><a href="{url:/site/brand_zone/id/$tmpId}"><img src="{webroot:$item[logo]}"  width="110" height="50"/>{$item['name']}</a></li>
						{/query}
					</ul>
				</div>
			</div>
			<!--品牌列表-->

			<!--最新评论-->
			<div class="comment box m_10">
				<div class="title2"><h2><img src="{skin:images/front/comment.gif}" alt="最新评论" width="155" height="36" /></h2></div>
				<div class="cont clearfix">
					{query:name=comment as co
						join=left join goods as go on co.goods_id eq go.id
						order=co.id desc
						limit=6
						where=co.status eq 1 AND go.is_del eq 0 AND go.id is not null
						fields=go.list_img as list_img,go.name as name,co.point,co.contents,co.goods_id
					}
					<dl class="no_bg">
						{set:$tmpGoodsId=$item['goods_id'];}
						<dt><a href="{url:/site/products/id/$tmpGoodsId}"><img src="{webroot:$item[list_img]}" width="65" height="65" /></a></dt>
						<dd><a href="{url:/site/products/id/$tmpGoodsId}">{$item['name']}</a></dd>
						<dd><span class="grade"><i style="width:{echo:$item['point']*14}px"></i></span></dd>
						<dd class="com_c">{$item['contents']}</dd>
					</dl>
					{/query}
				</div>
			</div>
			<!--最新评论-->

		</div>
	</div>
